package com.digitalchina.lxnsy.viewholder;

import android.graphics.Color;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.CancelReasonVO;
import com.digitalchina.lxnsy.toolkit.Utils;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：白彦东
 * 创建时间：2017年1月19日 09:57:22
 * 修改备注：
 * ================================================
 */

public class OrderCancelReasonHolder extends BaseViewHolder<CancelReasonVO> {

    private TextView tvCancelReason;

    public OrderCancelReasonHolder(ViewGroup parent) {
        super(parent, R.layout.item_order_cancel_reason);
        tvCancelReason = $(R.id.tv_cancel_reason);
    }

    @Override
    public void setData(CancelReasonVO reasons) {
        super.setData(reasons);

        tvCancelReason.setText(reasons != null ? reasons.getCancelReason() : "");

        if (reasons.isSelected()){
            tvCancelReason.setTextSize(TypedValue.COMPLEX_UNIT_PX, Utils.dip2px(getContext(), 16));
            tvCancelReason.setTextColor(getContext().getResources().getColor(R.color.colorFontBlack));
            tvCancelReason.setBackgroundColor(Color.parseColor("#CCCCCC"));
        }
        else{
            tvCancelReason.setTextSize(TypedValue.COMPLEX_UNIT_PX, Utils.dip2px(getContext(), 14));
            tvCancelReason.setTextColor(getContext().getResources().getColor(R.color.colorFontGray));
            tvCancelReason.setBackgroundColor(getContext().getResources().getColor(R.color.colorWhite));
        }
    }

}
